﻿<Window x:Class="Brjnk.GpxExplorer.UI.ImportFromClipboardWindow"
        xmlns:my1="clr-namespace:Brjnk.GpxExplorer.UI"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:common="clr-namespace:Brjnk.Common;assembly=Common"
        xmlns:l="clr-namespace:Brjnk.GpxExplorer.Localization"
        xmlns:my="clr-namespace:Brjnk.GpxExplorer.UI.Controls"
        xmlns:workspace="clr-namespace:Brjnk.GpxExplorer.Workspace"
        Title="{l:Loc titleImportFromClipboard}"
        FocusManager.FocusedElement="{Binding ElementName=okButton}"
        Width="400"
        Height="300"
        MinWidth="400"
        MinHeight="300"
        DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <StackPanel Grid.Column="1">
            <Button IsDefault="True"  Click="Button_Click" Content="{l:Loc ok}" Name="okButton" />
            <Button IsCancel="True"  Click="Button_Click_1" Content="{l:Loc cancel}" />
        </StackPanel>

        <ScrollViewer>
            <ItemsControl ItemsSource="{Binding Items}" AlternationCount="2">
                <ItemsControl.ItemTemplateSelector>
                    <common:GenericTemplateSelector>
                        <common:TemplateDefinition ObjectType="{x:Type workspace:CoordinatesFromClipboard}">
                            <DataTemplate>
                                <Grid>
                                    <Grid.Style>
                                        <Style TargetType="Grid">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContentPresenter}, Path=(ItemsControl.AlternationIndex)}" Value="0">
                                                    <Setter Property="Background" Value="{StaticResource AlternationBrush}" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Grid.Style>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition MaxWidth="500" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock FontWeight="Bold" Text="{Binding Coordinates}" />
                                    <TextBlock Grid.Column="1"
                                               HorizontalAlignment="Right"
                                               FontSize="9"
                                               Foreground="Gray"
                                               Text="{Binding CreationTime}" />
                                    <CheckBox Name="coordSearch"
                                              Grid.Row="1"
                                              Content="{l:Loc clipboardSearchCoordinates}"
                                              IsChecked="{Binding Search}" />
                                    <my:ColorPicker Grid.Row="1"
                                                    Grid.Column="1"
                                                    Visibility="{Binding ElementName=coordSearch,
                                                                         Path=IsChecked,
                                                                         Converter={StaticResource BooleanToVisibilityConverter}}"
                                                    Color="{Binding SearchColor}" />
                                    <CheckBox Name="coordWpt"
                                              Grid.Row="2"
                                              Content="{l:Loc clipboardCreateWaypoint}"
                                              IsChecked="{Binding CreateWaypoint}" />
                                    <TextBox Grid.Row="2"
                                             Grid.Column="1"
                                             Text="{Binding WaypointName}"
                                             Visibility="{Binding ElementName=coordWpt,
                                                                  Path=IsChecked,
                                                                  Converter={StaticResource BooleanToVisibilityConverter}}" />
                                    <my1:GoToCoordinatesPanel ButtonAddPushpin="False"  Grid.Row="4" Grid.ColumnSpan="2" GpsCoordinates="{Binding Coordinates}" />
                                    <!--<StackPanel Grid.Row="4"
                                                Grid.ColumnSpan="2"
                                                HorizontalAlignment="Right"
                                                Orientation="Horizontal">
                                        <Button MinWidth="0"
                                                Command="{Binding Source={workspace:GetWorkspace },
                                                                  Path=SearchService.PushpinsManager.AddPushpinAndGoCommand}"
                                                CommandParameter="{Binding Coordinates}">
                                            <Image Source="/Resources/Icons/map16.png" />
                                        </Button>
                                        <Button MinWidth="0"
                                                Command="{Binding Source={workspace:GetWorkspace },
                                                                  Path=SearchService.PushpinsManager.AddPushpinAndGoBigZoomCommand}"
                                                CommandParameter="{Binding Coordinates}">
                                            <StackPanel Orientation="Horizontal">
                                                <Image Source="/Resources/Icons/map16.png" />
                                                <Image Source="/Resources/Icons/plus16.png" />
                                            </StackPanel>
                                        </Button>
                                    </StackPanel>-->
                                </Grid>
                            </DataTemplate>
                        </common:TemplateDefinition>
                        <common:TemplateDefinition ObjectType="{x:Type workspace:DateTimeFromClipboard}">
                            <DataTemplate>
                                <Grid>
                                    <Grid.Style>
                                        <Style TargetType="Grid">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContentPresenter}, Path=(ItemsControl.AlternationIndex)}" Value="0">
                                                    <Setter Property="Background" Value="{StaticResource AlternationBrush}" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Grid.Style>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition MaxWidth="500" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock FontWeight="Bold" Text="{Binding DateTime}" />
                                    <TextBlock Grid.Column="1"
                                               HorizontalAlignment="Right"
                                               FontSize="9"
                                               Foreground="Gray"
                                               Text="{Binding CreationTime}" />
                                    <CheckBox Name="timeSearch"
                                              Grid.Row="1"
                                              Content="{l:Loc clipboardSearchDateTime}"
                                              IsChecked="{Binding Search}" />
                                    <my:ColorPicker Grid.Row="1"
                                                    Grid.Column="1"
                                                    HorizontalAlignment="Right"
                                                    Visibility="{Binding ElementName=timeSearch,
                                                                         Path=IsChecked,
                                                                         Converter={StaticResource BooleanToVisibilityConverter}}"
                                                    Color="{Binding SearchColor}" />
                                </Grid>
                            </DataTemplate>
                        </common:TemplateDefinition>
                    </common:GenericTemplateSelector>
                </ItemsControl.ItemTemplateSelector>
            </ItemsControl>
        </ScrollViewer>
    </Grid>
</Window>